package wuuxiang.crm;

import java.io.IOException;
import java.lang.reflect.Method;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import cn.gloryroad.TestDataDrivenByExcelFile;
import cn.gloryroad.TestFailCaptureScreen;

public class Login1 {
	public WebDriver driver;
	public Base loginShop;
	public String s;
	

	public WebDriver getDriver() {
		return driver;
	}

	public void setDriver(WebDriver driver) {
		this.driver = driver;
	}
	@BeforeMethod
	public void init() {
		System.setProperty("webdriver.firefox.bin", "D:/Firefox.exe");
		WebDriver driver = new FirefoxDriver();
		driver.manage().window().maximize();
		setDriver(driver);
	}
	@DataProvider(name = "login1")
	public static Object[][] words() throws IOException {
		// 调用类中的静态方法getTestData,获取excel文件的测试数据
		return TestDataDrivenByExcelFile.getTestData("E:\\", "testData.xlsx", "Sheet1");
	}
	@Test(dataProvider = "login1")

	public void  method (String username,String pas,String group,String yzm){
		Base loginShop = new Base(getDriver());
		loginShop.login(username, pas, group, yzm);
		if (username.equals(" ")){
			System.out.println("请填写用户名");
	}else{
		System.out.println("登录信息错误");
		
	}	
	
}
	@AfterMethod
	public void afterMethod() {
		driver.quit();
	}
	
	
	
}
